﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Model;
using System.Data;
using DAL;
using Common.Util;
using System.Transactions;
namespace BLL
{
   public class BookBLL
    {
       BookDAL dal = new BookDAL();
       public List<Book> GetBookBycondtion(int pageindex, int pagesize)
        {
            DataTable dt = dal.GetBookBycondtion(pageindex, pagesize);
            return ConverToExcs.ConvertToEx<Book>(dt);
        }
        public object GetBookBycondtionCount()
        {
            return dal.GetBookBycondtionCount();
        }

        public Book GetModel(int id)
        {

            return dal.GetModel(id);
        }
        public bool updateBook(Book model)
        {

            bool flag = true;
            
            
                try
                {

                    flag = this.Update(model);
 
                }
                catch (Exception ex)
                {
                    flag = false;
                }
            
            return flag;
        }
        public bool Update(Book model)
        {
            return dal.Update(model);
        }
    }
}
